<?php
/**
 * @package urCronPlugin
 * @author Marc Weistroff <marc.weistroff@gmail.com>
 * @version $Id: urCronRouting.class.php 11 2009-06-10 15:28:10Z flambeur $
 *
 * Code derived from sfGuardRouting.class.php from Fabien Potencier
 */

class urCronRouting
{
  static public function addRouteForFrontend(sfEvent $event)
  {
    $r = $event->getSubject();
    $r->prependRoute('ur_cron_feed', new sfDoctrineRouteCollection(array(
      'name'                 => 'ur_cron_feed',
      'model'                => 'urCronFeed',
      'module'               => 'urCronFeed',
      'prefix_path'          => 'urcron/from/',
      'requirements'         => array('sf_format' => '(?:html|xml)'),
    )));

    $r->prependRoute('ur_cron_item', new sfDoctrineRouteCollection(array(
      'name'                => 'ur_cron_item',
      'model'               => 'urCronItem',
      'module'              => 'urCronItem',
      'prefix_path'         => 'urcron/item/'
    )));

    $r->prependRoute('ur_cron_feed_show',
                     new sfDoctrineRoute('/urcron/from/:slug/:page.:sf_format',
                                         array('module' => 'urCronFeed',
                                               'action' => 'show',
                                               'page'   => 1,
                                               'sf_format' => 'html'),
                                         array('sf_format' => '(?:html|xml)',
                                               'page'      => '\d+'),
                                         array('type' => 'object',
                                               'model' => 'urCronFeed')));
    $r->prependRoute('ur_cron_tag_show',
                     new sfDoctrineRoute('/urcron/tag/:slug/:page',
                                         array('module' => 'urCronFeed',
                                               'action' => 'showTagged',
                                               'page'   => 1,
                                               'sf_format' => 'html'),
                                         array('sf_format' => '(?:html|xml)',
                                               'page'      => '\d+'),
                                         array('type' => 'object',
                                               'model' => 'urCronTag')));

    $r->prependRoute('ur_cron_item_show',
                     new sfDoctrineRoute('/urcron/item/:slug',
                                         array('module' => 'urCronItem',
                                               'action' => 'show'),
                                         array(),
                                         array('type' => 'object',
                                               'model' => 'urCronItem')));
    
  }

  static public function addRouteForAdminFeed(sfEvent $event)
  {
    $event->getSubject()->prependRoute('ur_cron_admin_feed', new sfDoctrineRouteCollection(array(
      'name'                 => 'ur_cron_admin_feed',
      'model'                => 'urCronFeed',
      'module'               => 'adminUrCronFeed',
      'prefix_path'          => 'ur_cron_admin_feed',
      'with_wildcard_routes' => true,
 //     'collection_actions'  => array('filter' => 'post', 'batch' => 'post'),
      'requirements'         => array(),
    )));
  }
  
  static public function addRouteForAdminItem(sfEvent $event)
  {
    $event->getSubject()->prependRoute('ur_cron_admin_item', new sfDoctrineRouteCollection(array(
      'name'                 => 'ur_cron_admin_item',
      'model'                => 'urCronItem',
      'module'               => 'adminUrCronItem',
      'prefix_path'          => 'ur_cron_admin_item',
      'with_wildcard_routes' => true,
 //     'collection_actions'  => array('filter' => 'post', 'batch' => 'post'),
      'requirements'         => array(),
    )));
  }

  static public function addRouteForAdminTag(sfEvent $event)
  {
    $event->getSubject()->prependRoute('ur_cron_admin_tag', new sfDoctrineRouteCollection(array(
      'name'                 => 'ur_cron_admin_tag',
      'model'                => 'urCronTag',
      'module'               => 'adminUrCronTag',
      'prefix_path'          => 'ur_cron_tag',
      'with_wildcard_routes' => true,
 //     'collection_actions'  => array('filter' => 'post', 'batch' => 'post'),
      'requirements'         => array(),
    )));
  }


}
?>
